home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / X11 / ThreadsI.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-02-14  |  4.3 KB  |  131 lines

  1. /* $Xorg: ThreadsI.h,v 1.4 2001/02/09 02:03:59 xorgcvs Exp $ */
  2.  
  3. /************************************************************
  4. Copyright 1993 by Sun Microsystems, Inc. Mountain View, CA.
  5.  
  6.                     All Rights Reserved
  7.  
  8. Permission  to  use,  copy,  modify,  and  distribute   this
  9. software  and  its documentation for any purpose and without
  10. fee is hereby granted, provided that the above copyright no-
  11. tice  appear  in all copies and that both that copyright no-
  12. tice and this permission notice appear in  supporting  docu-
  13. mentation,  and  that the name Sun not be used in advertising 
  14. or publicity pertaining to distribution  of  the software  
  15. without specific prior written permission. Sun makes no 
  16. representations about the suitability of this software for 
  17. any purpose. It is provided "as is" without any express or 
  18. implied warranty.
  19.  
  20. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
  21. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
  22. NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
  23. ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  24. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
  25. PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
  26. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  27. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  28.  
  29. ********************************************************/
  30.  
  31. /*
  32.  
  33. Copyright 1994, 1998  The Open Group
  34.  
  35. Permission to use, copy, modify, distribute, and sell this software and its
  36. documentation for any purpose is hereby granted without fee, provided that
  37. the above copyright notice appear in all copies and that both that
  38. copyright notice and this permission notice appear in supporting
  39. documentation.
  40.  
  41. The above copyright notice and this permission notice shall be included in
  42. all copies or substantial portions of the Software.
  43.  
  44. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  45. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  47. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  48. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  49. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  50.  
  51. Except as contained in this notice, the name of The Open Group shall not be
  52. used in advertising or otherwise to promote the sale, use or other dealings
  53. in this Software without prior written authorization from The Open Group.
  54.  
  55. */
  56. /* $XFree86: xc/lib/Xt/ThreadsI.h,v 3.5 2001/12/14 19:56:31 dawes Exp $ */
  57.  
  58. #ifndef _XtThreadsI_h
  59. #define _XtThreadsI_h
  60.  
  61. #include <X11/XlibConf.h>
  62.  
  63. #ifdef XTHREADS
  64.  
  65. typedef struct _LockRec *LockPtr;
  66.  
  67. typedef void (*ThreadAppProc)(
  68.     XtAppContext /* app */
  69. );
  70.  
  71. typedef void (*ThreadAppYieldLockProc)(
  72.     XtAppContext, /* app */
  73.     Boolean*, /* push_thread */
  74.     Boolean*, /* pushed_thread */
  75.     int* /* level */
  76. );
  77.  
  78. typedef void (*ThreadAppRestoreLockProc)(
  79.     XtAppContext /* app */,
  80.     int, /* level */
  81.     Boolean* /* pushed_thread */
  82. );
  83.  
  84. extern void (*_XtProcessLock)(
  85.     void
  86. );
  87.  
  88. extern void (*_XtProcessUnlock)(
  89.     void
  90. );
  91.  
  92. extern void (*_XtInitAppLock)(
  93.     XtAppContext /* app */
  94. );
  95.  
  96. #define INIT_APP_LOCK(app) if(_XtInitAppLock) (*_XtInitAppLock)(app)
  97. #define FREE_APP_LOCK(app) if(app && app->free_lock)(*app->free_lock)(app)
  98.  
  99. #define LOCK_PROCESS if(_XtProcessLock)(*_XtProcessLock)()
  100. #define UNLOCK_PROCESS if(_XtProcessUnlock)(*_XtProcessUnlock)()
  101. #define LOCK_APP(app) if(app && app->lock)(*app->lock)(app)
  102. #define UNLOCK_APP(app) if(app && app->unlock)(*app->unlock)(app)
  103.  
  104. #define YIELD_APP_LOCK(app,push,pushed,level)\
  105.      if(app && app->yield_lock) (*app->yield_lock)(app,push,pushed,level)
  106. #define RESTORE_APP_LOCK(app,level,pushed)\
  107.      if(app && app->restore_lock) (*app->restore_lock)(app,level,pushed)
  108.  
  109. #define WIDGET_TO_APPCON(w) \
  110.     XtAppContext app = (w && _XtProcessLock ? \
  111.     XtWidgetToApplicationContext(w) : NULL)
  112.  
  113. #define DPY_TO_APPCON(d) \
  114.     XtAppContext app = (_XtProcessLock ? XtDisplayToApplicationContext(d): 0)
  115.  
  116. #else /* defined(XTHREADS) */
  117.  
  118. #define LOCK_PROCESS
  119. #define UNLOCK_PROCESS
  120. #define LOCK_APP(app)
  121. #define UNLOCK_APP(app)
  122.  
  123. #define INIT_APP_LOCK(app)
  124. #define FREE_APP_LOCK(app)
  125.  
  126. #define WIDGET_TO_APPCON(w)
  127. #define DPY_TO_APPCON(d)
  128.  
  129. #endif /* !defined(XTHREADS) */
  130. #endif /* _XtThreadsI_h */
  131.